package com.java.socket.tcp.multiclient.multithread.server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 多客户端Socket情况下的服务端Socket
 *
 * @author xzmeasy
 * @version 1.0
 * @since 星期一 十二月,2018
 */
public class ServerSocketExample {

    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(8888);
            System.out.println("服务端Socket启动了...");
            while (true) {
                Socket socket = serverSocket.accept();
                ServerSocketThread serverSocketThread = new ServerSocketThread(socket);
                serverSocketThread.start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
